﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

public class FormGameSettings : Form
{
    private Label m_LabelPlayers = null;
    private Label m_LabelPlayer1;
    private Label m_LabelPlayer2;
    private CheckBox m_CheckBoxPlayer2;
    private TextBox m_TextBoxPlayer1;
    private TextBox m_TextBoxPlayer2;
    private Label m_LabelBoardSize;
    private Label m_LabelRows;
    private NumericUpDown m_NumericUpDownRows;
    private NumericUpDown m_NumericUpDownCols;
    private Label m_LabelCols;
    private Button m_ButtonStart;

    public string FirstPlayerName
    {
        get { return this.m_TextBoxPlayer1.Text; }
        set { this.m_TextBoxPlayer1.Text = value; }
    }

    public string SecondPlayerName
    {
        get { return this.m_TextBoxPlayer2.Text; }
    }

    public int RowSize
    {
        get { return (int)this.m_NumericUpDownRows.Value; }
    }

    public int ColSize
    {
        get { return (int)this.m_NumericUpDownCols.Value; }
    }

    public bool IsTwoUserPlayers
    {
        get { return this.m_CheckBoxPlayer2.Checked; }
    }

    public FormGameSettings()
    {
        this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
        this.StartPosition = FormStartPosition.CenterScreen;
        this.Text = "Game Settings";
        this.initializeComponent();
    }

    private void initializeComponent()
    {
        this.m_LabelPlayers = new System.Windows.Forms.Label();
        this.m_LabelPlayer1 = new System.Windows.Forms.Label();
        this.m_LabelPlayer2 = new System.Windows.Forms.Label();
        this.m_CheckBoxPlayer2 = new System.Windows.Forms.CheckBox();
        this.m_TextBoxPlayer1 = new System.Windows.Forms.TextBox();
        this.m_TextBoxPlayer2 = new System.Windows.Forms.TextBox();
        this.m_LabelBoardSize = new System.Windows.Forms.Label();
        this.m_LabelRows = new System.Windows.Forms.Label();
        this.m_NumericUpDownRows = new System.Windows.Forms.NumericUpDown();
        this.m_NumericUpDownCols = new System.Windows.Forms.NumericUpDown();
        this.m_LabelCols = new System.Windows.Forms.Label();
        this.m_ButtonStart = new System.Windows.Forms.Button();
        ((System.ComponentModel.ISupportInitialize)this.m_NumericUpDownRows).BeginInit();
        ((System.ComponentModel.ISupportInitialize)this.m_NumericUpDownCols).BeginInit();
        this.SuspendLayout();
        //// 
        //// m_LabelPlayers
        //// 
        this.m_LabelPlayers.AutoSize = true;
        this.m_LabelPlayers.Location = new System.Drawing.Point(12, 9);
        this.m_LabelPlayers.Name = "m_LabelPlayers";
        this.m_LabelPlayers.Size = new System.Drawing.Size(44, 13);
        this.m_LabelPlayers.TabIndex = 0;
        this.m_LabelPlayers.Text = "Players:";
        //// 
        //// m_LabelPlayer1
        //// 
        this.m_LabelPlayer1.AutoSize = true;
        this.m_LabelPlayer1.Location = new System.Drawing.Point(21, 35);
        this.m_LabelPlayer1.Name = "m_LabelPlayer1";
        this.m_LabelPlayer1.Size = new System.Drawing.Size(48, 13);
        this.m_LabelPlayer1.TabIndex = 1;
        this.m_LabelPlayer1.Text = "Player 1:";
        //// 
        //// m_LabelPlayer2
        //// 
        this.m_LabelPlayer2.AutoSize = true;
        this.m_LabelPlayer2.Location = new System.Drawing.Point(45, 67);
        this.m_LabelPlayer2.Name = "m_LabelPlayer2";
        this.m_LabelPlayer2.Size = new System.Drawing.Size(48, 13);
        this.m_LabelPlayer2.TabIndex = 2;
        this.m_LabelPlayer2.Text = "Player 2:";
        //// 
        //// m_CheckBoxPlayer2
        //// 
        this.m_CheckBoxPlayer2.AutoSize = true;
        this.m_CheckBoxPlayer2.Location = new System.Drawing.Point(24, 67);
        this.m_CheckBoxPlayer2.Name = "m_CheckBoxPlayer2";
        this.m_CheckBoxPlayer2.Size = new System.Drawing.Size(15, 14);
        this.m_CheckBoxPlayer2.TabIndex = 3;
        this.m_CheckBoxPlayer2.UseVisualStyleBackColor = true;
        this.m_CheckBoxPlayer2.CheckedChanged += new System.EventHandler(this.m_CheckBoxPlayer2_CheckedChanged);
        //// 
        //// m_TextBoxPlayer1
        //// 
        this.m_TextBoxPlayer1.Location = new System.Drawing.Point(99, 35);
        this.m_TextBoxPlayer1.Name = "m_TextBoxPlayer1";
        this.m_TextBoxPlayer1.Size = new System.Drawing.Size(109, 20);
        this.m_TextBoxPlayer1.TabIndex = 4;
        //// 
        //// m_TextBoxPlayer2
        //// 
        this.m_TextBoxPlayer2.Enabled = false;
        this.m_TextBoxPlayer2.Location = new System.Drawing.Point(99, 64);
        this.m_TextBoxPlayer2.Name = "m_TextBoxPlayer2";
        this.m_TextBoxPlayer2.Size = new System.Drawing.Size(109, 20);
        this.m_TextBoxPlayer2.TabIndex = 5;
        this.m_TextBoxPlayer2.Text = "[Computer]";
        //// 
        //// m_LabelBoardSize
        //// 
        this.m_LabelBoardSize.AutoSize = true;
        this.m_LabelBoardSize.Location = new System.Drawing.Point(12, 111);
        this.m_LabelBoardSize.Name = "m_LabelBoardSize";
        this.m_LabelBoardSize.Size = new System.Drawing.Size(61, 13);
        this.m_LabelBoardSize.TabIndex = 6;
        this.m_LabelBoardSize.Text = "Board Size:";
        //// 
        //// m_LabelRows
        //// 
        this.m_LabelRows.AutoSize = true;
        this.m_LabelRows.Location = new System.Drawing.Point(24, 138);
        this.m_LabelRows.Name = "m_LabelRows";
        this.m_LabelRows.Size = new System.Drawing.Size(37, 13);
        this.m_LabelRows.TabIndex = 7;
        this.m_LabelRows.Text = "Rows:";
        //// 
        //// m_NumericUpDownRows
        //// 
        this.m_NumericUpDownRows.Location = new System.Drawing.Point(66, 136);
        this.m_NumericUpDownRows.Maximum = new decimal(new int[] 
        {
            10,
            0,
            0,
            0
        });
        this.m_NumericUpDownRows.Minimum = new decimal(new int[] 
        {
            4,
            0,
            0,
            0
        });
        this.m_NumericUpDownRows.Name = "m_NumericUpDownRows";
        this.m_NumericUpDownRows.Size = new System.Drawing.Size(37, 20);
        this.m_NumericUpDownRows.TabIndex = 8;
        this.m_NumericUpDownRows.Value = new decimal(new int[] 
        {
            4,
            0,
            0,
            0
        });
        //// 
        //// m_NumericUpDownCols
        //// 
        this.m_NumericUpDownCols.Location = new System.Drawing.Point(171, 136);
        this.m_NumericUpDownCols.Maximum = new decimal(new int[] 
        {
            10,
            0,
            0,
            0
        });
        this.m_NumericUpDownCols.Minimum = new decimal(new int[] 
        {
            4,
            0,
            0,
            0
        });
        this.m_NumericUpDownCols.Name = "m_NumericUpDownCols";
        this.m_NumericUpDownCols.Size = new System.Drawing.Size(37, 20);
        this.m_NumericUpDownCols.TabIndex = 10;
        this.m_NumericUpDownCols.Value = new decimal(new int[] 
        {
            7,
            0,
            0,
            0
        });
        //// 
        //// m_LabelCols
        //// 
        this.m_LabelCols.AutoSize = true;
        this.m_LabelCols.Location = new System.Drawing.Point(135, 138);
        this.m_LabelCols.Name = "m_LabelCols";
        this.m_LabelCols.Size = new System.Drawing.Size(30, 13);
        this.m_LabelCols.TabIndex = 9;
        this.m_LabelCols.Text = "Cols:";
        //// 
        //// m_ButtonStart
        //// 
        this.m_ButtonStart.Location = new System.Drawing.Point(15, 180);
        this.m_ButtonStart.Name = "m_ButtonStart";
        this.m_ButtonStart.Size = new System.Drawing.Size(193, 23);
        this.m_ButtonStart.TabIndex = 11;
        this.m_ButtonStart.Text = "Start!";
        this.m_ButtonStart.UseVisualStyleBackColor = true;
        this.m_ButtonStart.Click += new System.EventHandler(this.m_ButtonStart_Click);
        //// 
        //// FormGameSettings
        //// 
        this.ClientSize = new System.Drawing.Size(233, 216);
        this.Controls.Add(this.m_ButtonStart);
        this.Controls.Add(this.m_NumericUpDownCols);
        this.Controls.Add(this.m_LabelCols);
        this.Controls.Add(this.m_NumericUpDownRows);
        this.Controls.Add(this.m_LabelRows);
        this.Controls.Add(this.m_LabelBoardSize);
        this.Controls.Add(this.m_TextBoxPlayer2);
        this.Controls.Add(this.m_TextBoxPlayer1);
        this.Controls.Add(this.m_CheckBoxPlayer2);
        this.Controls.Add(this.m_LabelPlayer2);
        this.Controls.Add(this.m_LabelPlayer1);
        this.Controls.Add(this.m_LabelPlayers);
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Name = "FormGameSettings";
        this.RightToLeft = System.Windows.Forms.RightToLeft.No;
        this.ShowIcon = false;
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "Game Settings";
        this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormGameSettings_FormClosing);
        ((System.ComponentModel.ISupportInitialize)this.m_NumericUpDownRows).EndInit();
        ((System.ComponentModel.ISupportInitialize)this.m_NumericUpDownCols).EndInit();
        this.ResumeLayout(false);
        this.PerformLayout();
    }

    private void m_ButtonStart_Click(object sender, EventArgs e)
    {
        this.DialogResult = DialogResult.OK;
    }

    private void m_CheckBoxPlayer2_CheckedChanged(object sender, EventArgs e)
    {
        this.m_TextBoxPlayer2.Enabled = !this.m_TextBoxPlayer2.Enabled;

        if (!this.m_TextBoxPlayer2.Enabled)
        {
            this.m_TextBoxPlayer2.Text = "[Computer]";
        }
        else
        {
            this.m_TextBoxPlayer2.Text = string.Empty;
        }
    }

    private void FormGameSettings_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (e.CloseReason == CloseReason.UserClosing)
        {
            this.DialogResult = DialogResult.Abort;
        }
    }
}